﻿//<TunynetCopyright>
//--------------------------------------------------------------
//<copyright>青岛拓宇网络科技有限公司 2005-2008</copyright>
//<version>V0.5</verion>
//<createdate>2008-5-5</createdate>
//<author>xier</author>
//<email>xier@tunynet.com</email>
//<log date="2008-5-5">创建</log>
//--------------------------------------------------------------
//</TunynetCopyright>

using System;
using System.Collections.Generic;
using System.Text;
using System.Workflow.ComponentModel.Compiler;

namespace ChinaCustoms.Qingdao.Workflow.Activities
{
    public class CodeNameValidator : ActivityValidator 
	{
        public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            ValidationErrorCollection errors = base.Validate(manager, obj);
            ChinaCustomsBaseActivity baseActivity = obj as ChinaCustomsBaseActivity;
            if (baseActivity != null)
            {
                if (baseActivity.Parent != null)
                {
                    if (string.IsNullOrEmpty(baseActivity.CodeName) == true)
                    {
                        errors.Add(ValidationError.GetNotSetValidationError("CodeName"));
                    }
                }
            }
            return errors;
        }
	}
}
